<?php

namespace App\Http\Requests\adver;

use App\Http\Requests\Request;

class addRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            "name" => "required",
            "order" => "required|regex:/^\d+$/",
            "pic" => "required|image",
            "editorValue" => "required",
        ];
    }

    public function messages() {
        return [
            "name.required" => "名称不能为空！",
            "order.required" => "序号不能为空！",
            "order.regex" => "排序号请输入正确的数字！",
            "pic.required" => "图片上传不能为空！",
            "pic.image" => "请上传正确格式的图片！",
            "editorValue.required" => "描述不能为空！",
        ];
    }
}
